package main

import "fmt"

type sdu struct {
	username string
	age      int
	sex      string
}

func main() {
	var sdu1 = sdu{
		"name",
		12,
		"男",
	}
	fmt.Printf("%#v %T\n", sdu1, sdu1)
	fmt.Println("-----------------------------------------------")

	var sdu2 sdu
	sdu2.username = "ssy"
	sdu2.age = 23
	sdu2.sex = "女"
	fmt.Printf("%#v %T\n", sdu2, sdu2)
	fmt.Println("-----------------------------------------------")

	sdu3 := new(sdu)
	sdu3.username = "chj" //等价于 (*sdu3).username = "chj"
	sdu3.age = 34
	sdu3.sex = "男"
	fmt.Printf("%#v %T\n", sdu3, sdu3)
	fmt.Println("-----------------------------------------------")

	sdu4 := &sdu{}
	sdu4.username = "chj"
	sdu4.age = 34
	sdu4.sex = "男"
	fmt.Printf("%#v %T\n", sdu4, sdu4)
	fmt.Println("-----------------------------------------------")

	var sdu5 = sdu{
		username: "chl",
		age:      46,
		sex:      "男",
	}
	fmt.Printf("%#v %T\n", sdu5, sdu5)
	fmt.Println("-----------------------------------------------")

	var sdu6 = &sdu{
		username: "chl",
		age:      46,
		sex:      "男",
	}
	fmt.Printf("%#v %T\n", sdu6, sdu6)
	fmt.Println("-----------------------------------------------")
}
